<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>查看病历</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">		
		<link rel="stylesheet" href="css/mui.min.css">
		<link rel="stylesheet" href="css/grandeHealth.css">
		<style>
			.mui-content{padding: 0!important;}
			#online_details{font-size: 16px;}
			#online_details input{font-size: 16px;}
			#online_details textarea{padding: 0;}
			#online_details .tonyli-row{border-bottom: 1px solid #ccc;padding:0 0 10px 15px;}
			#online_details .tonyli-row label{width:40%;line-height: 35px;}
			#online_details .tonyli-row input{width:60%;}
			#online_details .mui-row .tonyli-row{border-right: 1px solid #ccc;border-bottom: 1px solid #ccc;}
			#online_details .mui-row .tonyli-row label{width: 45%;}
			#online_details .mui-row .tonyli-row input{width: 55%;}
			#online_details .tige{padding: 10px 15px;}
			#online_details .tige .tige-row{}
			#online_details .tige .tige-row label{float: left;margin-top: 20px;width: 30%;}
			#online_details .tige .tige-row input{padding:0;text-align: left;width: 29%;border-bottom: 1px solid #ccc;height: 20px;margin-top: 20px;}
			#online_details .medication{padding-top: 10px;}
			#online_details .medication h3{line-height: 40px;}
			#online_details .tonyli-row .medication_plan{height: 25px;}
			#online_details .tonyli-row .medication_plan h4{float: left;}
			#online_details .tonyli-row .medication_plan span{float: right;color: #333;margin-right: 15px;}
			#online_details .medication input{width:86%;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
			.settled{border: none!important;text-align: right;padding: 15px 0;}
			.settled input{width: 59%!important;height: 20px;border-bottom: 1px solid #ccc;}
			.medicals p{margin-top: 10px;}
			#medicationAll .borderM:last-child{border: 0!important;}
		</style>
	</head>
	<body>

		<div class="mui-content">
	      <div class="mui-content-padded" style="margin: 0;">
	        <form class="mui-input-group" id="online_details">
	        	<div class="mui-row">
			        <div class="mui-col-sm-6 mui-col-xs-6">
			            <div class="tonyli-row">
				            <label>姓名:</label>
				            <input type="text" id="name" name="name" value=""/>
		          		</div>
			        </div>
			        <div class="mui-col-sm-6 mui-col-xs-6">
			            <div class="tonyli-row">
				            <label>性别:</label>
				            <input type="text" id="sex" name="sex" value=""/>
		          		</div>
			        </div>
			    </div>
	
	            <div class="tonyli-row">
		            <label>年龄:</label>
		            <input type="text" id="age" name="age" value=""/>
	            </div>
	          
	            <div class="tonyli-row">
		            <label>医保卡号:</label>
		            <input type="text" id="idCard" name="idCard" value=""/>
	            </div>
	          
	            <div class="tonyli-row">
		            <label>就诊卡号:</label>
		            <input type="text" id="viscard" name="viscard" value=""/>
	            </div>
	          
	            <div class="tonyli-row">
		            <label>主诉:</label>
		            <input type="text" id="complaint" name="complaint" value=""/>
	            </div>
	          
	            <div class="tonyli-row">
		            <label>既往史:</label>
		            <input type="text" id="pasthistory" name="pasthistory" value=""/>
	            </div>
	            
	            <div class="tonyli-row tige">
	            	<label style="line-height: 33px;">体格检查:</label>
		            <div class="mui-row">
				        <div class="mui-col-sm-7 mui-col-xs-7"> 
				            <div class="tige-row">
					            <label>体温:</label>
					            <input type="text" id="tiwen" name="tiwen" value=""/>°C
			          		</div>
				        </div>
				        <div class="mui-col-sm-5 mui-col-xs-5">
				            <div class="tige-row">
					            <label>心率:</label>
					            <input type="text" id="xinlv" name="xinlv" value=""/>次/分
			          		</div>
				        </div>
				        <div class="mui-col-sm-7 mui-col-xs-7"> 
				            <div class="tige-row">
					            <label>血压:</label>
					            <input type="text" id="xueya" name="xueya" value=""/>mmHG
			          		</div>
				        </div>
				        <div class="mui-col-sm-5 mui-col-xs-5">
				            <div class="tige-row">
					            <label>体重:</label>
					            <input type="text" id="weight" name="weight" value=""/>Kg
			          		</div>
				        </div>
				        <div class="mui-col-sm-7 mui-col-xs-7"> 
				            <div class="tige-row">
					            <label>血糖:</label>
					            <input type="text" id="xuetang" name="xuetang" value=""/>mmol/L
			          		</div>
				        </div>
				        <div class="mui-col-sm-5 mui-col-xs-5">
				            <div class="tige-row">
					            <label>血氧:</label>
					            <input type="text" id="xueyang" name="xueyang" value=""/>%
			          		</div>
				        </div>
				    </div>
	            </div>
		            
	          	<div class="tonyli-row">
		            <label>诊断:</label>
		            <textarea id="diagnosis" disabled="disabled" name="diagnosis" value=""></textarea>
	            </div>
	            
	            <div class="tonyli-row medication" style="border:0;">
		            <h3>用药方案:</h3>
		            <div id="medicationAll">
		            	
		            </div>        
	            </div>
	            
	            <ul class="mui-input-group " id="online_details">
            
		            <li class="tonyli-row">
			            <label>健康方案:</label>
			            <div id="hePlan" class="telContent">
							<!--建议采用以下食疗方式：
							山楂30～40克，粳米100克，砂糖10克。先将山楂入砂锅煎取浓汁，去渣，然后加入粳米、砂糖煮粥。每日服2次，可作上、下午加餐用，不宜空腹服，7～10日为一疗程。-->
			            </div>
		            </li>
		            <li class="tonyli-row" style="border: 0;">
			            <label>注意事项:</label>
			            <div id="matter" class="telContent">
			            	<!--1、勿过量或太强太累，采取循序渐进的方式来增加活动量。
							2、穿着舒适吸汗的衣服：选棉质衣料，运动鞋等是必要的。
							3、饥饿时或饭后一小时不宜做运动。-->
			            </div>
		            </li>
		        </ul>
        
	            <div class="tonyli-row settled">
		            <label>医师:</label>
		            <input type="text" id="doctor" name="doctor" value=""/>
	            </div>
	                      
	            <div class="tonyli-row settled">
		            <label>日期:</label>
		            <input type="text" id="date" name="date" value=""/>
	            </div>
	        </form>
	      </div>
	    </div>
		     		
		<script src="js/jquery-1.7.2.min.js"></script>
		<script src="js/mui.min.js"></script>
		<script src="js/grandeHealth.js"></script>
		<script>
			$('input').attr('disabled',true);//控制input不可输入
			$('input').css('opacity',1);
			// 得到window.location的某个参数
			var str;
			if (location.search.indexOf("?") != -1) {  
			  var str = location.search.substr(1);  
			   var Blguid = str.slice(5)//病历id
			} 
			
			/*
			 * 获取线上病历详情
			 * */
			var BLGUID = GetLocationParam('caseGuid');//病历guid
			var arry = {};
			var webUrl = XHDOC_WEBBASE + "sickblhdr/getSickblhdr?sickid="+BLGUID;	
			
			try {
				$.ajax({
					url: webUrl,
					type: "GET",
					dataType: "json",
					success: function(data) {
											
						try {	
							
								if(data.code == 000){									
									arry = data.data;
									console.log(arry.sickblhdr.note)
									$('#name').val(arry.sickblhdr.name);//姓名
									if(arry.sickblhdr.sex == 1){$('#sex').val('男');}else if(arry.sickblhdr.sex == 2){$('#sex').val('女');}
									$('#age').val(arry.sickblhdr.age+arry.sickblhdr.ageoptions);//年龄
									$('#idCard').val(arry.sickblhdr.medicarecard);//医保卡号
									$('#viscard').val(arry.sickblhdr.cardid);//就诊卡号
									$('#complaint').val(arry.sickblhdr.mainn);//主诉
									$('#pasthistory').val(arry.sickblhdr.jws);//既往史
									$('#tiwen').val(arry.sickblhdr.tw);//体温
									$('#xinlv').val(arry.sickblhdr.xl);//心率
									$('#xueya').val(arry.sickblhdr.xy1+'/'+arry.sickblhdr.xy2);//血压
									$('#weight').val(arry.sickblhdr.weight);//体重
									$('#xuetang').val(arry.sickblhdr.clucose);//血糖
									$('#xueyang').val(arry.sickblhdr.glucose);//血氧
									$('#diagnosis').val(arry.sickblhdr.zdnam);//诊断
									$('#doctor').val(arry.sickblhdr.doc);//医师
									$('#date').val(arry.sickblhdr.crtdat);//日期
									
									(arry.sickblhdr.bjfa != '') ? $('#hePlan').html(arry.sickblhdr.bjfa) : $('#hePlan').html('无');//健康方案
									(arry.sickblhdr.note != '') ? $('#matter').html(arry.sickblhdr.note) : $('#matter').html('无');//注意事项
								}
							
							//用药方案
							for(var i = 0; i < arry.dTsickbldtl.length; i ++){
								var yHtml = '<div class="borderM" style="border-bottom: 1px dashed #ccc;margin-bottom: 15px;">'+
								            	'<div class="medication_plan">'+
									            	'<h4>'+arry.dTsickbldtl[i].drunam+'</h4><span>×'+arry.dTsickbldtl[i].ypnum+'('+arry.dTsickbldtl[i].unit+arry.dTsickbldtl[i].smlunt+')'+'</span>'+
									            '</div>'+
									            '<div class="medicals" style="overflow:hidden;width:100%;">'+
										            '<p style="color:#333;float:left">用法:</p>'+
										            '<input style="float:left" type="text" name="username" value="'+arry.dTsickbldtl[i].kfwyname+','+arry.dTsickbldtl[i].pian+','+arry.dTsickbldtl[i].pc+'"/>'+
									            '</div>'+
								            '</div>';
							    $('#medicationAll').append(yHtml);
							}
			
						} catch(e) {
							mui.toast('获取数据失败')
						}
					},
					error: function(xhr, textStatus, error) {						
						if(textStatus == "error")
						mui.toast('请检查网络连接');
					}
			
				});
			
			} catch(e) {
				mui.toast("请检查网络连接");
			}

		</script>
	</body>
</html>


